using Microsoft.VisualBasic.CompilerServices;
using SJVars;
using Spacejock;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using yWriter6.My.Resources;

namespace yWriter6
{
	[DesignerGenerated]
	public class frmIndexCards : Form
	{
		private IContainer components;

		[CompilerGenerated]
		[AccessedThroughProperty("NUDDown")]
		private NumericUpDown _NUDDown;

		[CompilerGenerated]
		[AccessedThroughProperty("NUDAcross")]
		private NumericUpDown _NUDAcross;

		[CompilerGenerated]
		[AccessedThroughProperty("Label1")]
		private Label _Label1;

		[CompilerGenerated]
		[AccessedThroughProperty("Label2")]
		private Label _Label2;

		[CompilerGenerated]
		[AccessedThroughProperty("Label3")]
		private Label _Label3;

		[CompilerGenerated]
		[AccessedThroughProperty("lblPerPage")]
		private Label _lblPerPage;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdOK")]
		private Button _cmdOK;

		[CompilerGenerated]
		[AccessedThroughProperty("ToolTip1")]
		private ToolTip _ToolTip1;

		[CompilerGenerated]
		[AccessedThroughProperty("Label4")]
		private Label _Label4;

		[CompilerGenerated]
		[AccessedThroughProperty("NUDMargin")]
		private NumericUpDown _NUDMargin;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbFont")]
		private ComboBox _cmbFont;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbFontSize")]
		private ComboBox _cmbFontSize;

		[CompilerGenerated]
		[AccessedThroughProperty("Label5")]
		private Label _Label5;

		internal virtual NumericUpDown NUDDown
		{
			[CompilerGenerated]
			get
			{
				return _NUDDown;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = NumericUpDown1_ValueChanged;
				NumericUpDown nUDDown = _NUDDown;
				if (nUDDown != null)
				{
					nUDDown.ValueChanged -= value2;
				}
				_NUDDown = value;
				nUDDown = _NUDDown;
				if (nUDDown != null)
				{
					nUDDown.ValueChanged += value2;
				}
			}
		}

		internal virtual NumericUpDown NUDAcross
		{
			[CompilerGenerated]
			get
			{
				return _NUDAcross;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = NUDAcross_ValueChanged;
				NumericUpDown nUDAcross = _NUDAcross;
				if (nUDAcross != null)
				{
					nUDAcross.ValueChanged -= value2;
				}
				_NUDAcross = value;
				nUDAcross = _NUDAcross;
				if (nUDAcross != null)
				{
					nUDAcross.ValueChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("Label1")]
		internal virtual Label Label1
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label2")]
		internal virtual Label Label2
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label3")]
		internal virtual Label Label3
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("lblPerPage")]
		internal virtual Label lblPerPage
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual Button cmdOK
		{
			[CompilerGenerated]
			get
			{
				return _cmdOK;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdOK_Click;
				Button cmdOK = _cmdOK;
				if (cmdOK != null)
				{
					cmdOK.Click -= value2;
				}
				_cmdOK = value;
				cmdOK = _cmdOK;
				if (cmdOK != null)
				{
					cmdOK.Click += value2;
				}
			}
		}

		[field: AccessedThroughProperty("ToolTip1")]
		internal virtual ToolTip ToolTip1
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label4")]
		internal virtual Label Label4
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual NumericUpDown NUDMargin
		{
			[CompilerGenerated]
			get
			{
				return _NUDMargin;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = NumericUpDown1_ValueChanged;
				NumericUpDown nUDMargin = _NUDMargin;
				if (nUDMargin != null)
				{
					nUDMargin.ValueChanged -= value2;
				}
				_NUDMargin = value;
				nUDMargin = _NUDMargin;
				if (nUDMargin != null)
				{
					nUDMargin.ValueChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("cmbFont")]
		internal virtual ComboBox cmbFont
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("cmbFontSize")]
		internal virtual ComboBox cmbFontSize
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label5")]
		internal virtual Label Label5
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		public frmIndexCards()
		{
			base.Load += frmIndexCards_Load;
			InitializeComponent();
		}

		[DebuggerNonUserCode]
		protected override void Dispose(bool disposing)
		{
			try
			{
				if (disposing && components != null)
				{
					components.Dispose();
				}
			}
			finally
			{
				base.Dispose(disposing);
			}
		}

		[System.Diagnostics.DebuggerStepThrough]
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();
			NUDDown = new System.Windows.Forms.NumericUpDown();
			NUDAcross = new System.Windows.Forms.NumericUpDown();
			Label1 = new System.Windows.Forms.Label();
			Label2 = new System.Windows.Forms.Label();
			Label3 = new System.Windows.Forms.Label();
			lblPerPage = new System.Windows.Forms.Label();
			cmdOK = new System.Windows.Forms.Button();
			Label4 = new System.Windows.Forms.Label();
			NUDMargin = new System.Windows.Forms.NumericUpDown();
			ToolTip1 = new System.Windows.Forms.ToolTip(components);
			cmbFont = new System.Windows.Forms.ComboBox();
			cmbFontSize = new System.Windows.Forms.ComboBox();
			Label5 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)NUDDown).BeginInit();
			((System.ComponentModel.ISupportInitialize)NUDAcross).BeginInit();
			((System.ComponentModel.ISupportInitialize)NUDMargin).BeginInit();
			SuspendLayout();
			NUDDown.Location = new System.Drawing.Point(113, 51);
			NUDDown.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			NUDDown.Maximum = new decimal(new int[4]
			{
				12,
				0,
				0,
				0
			});
			NUDDown.Minimum = new decimal(new int[4]
			{
				1,
				0,
				0,
				0
			});
			NUDDown.Name = "NUDDown";
			NUDDown.Size = new System.Drawing.Size(58, 25);
			NUDDown.TabIndex = 0;
			NUDDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			ToolTip1.SetToolTip(NUDDown, "Number of cards down the page");
			NUDDown.Value = new decimal(new int[4]
			{
				3,
				0,
				0,
				0
			});
			NUDAcross.Location = new System.Drawing.Point(113, 22);
			NUDAcross.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			NUDAcross.Maximum = new decimal(new int[4]
			{
				5,
				0,
				0,
				0
			});
			NUDAcross.Minimum = new decimal(new int[4]
			{
				1,
				0,
				0,
				0
			});
			NUDAcross.Name = "NUDAcross";
			NUDAcross.Size = new System.Drawing.Size(58, 25);
			NUDAcross.TabIndex = 0;
			NUDAcross.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			ToolTip1.SetToolTip(NUDAcross, "Number of cards across the page");
			NUDAcross.Value = new decimal(new int[4]
			{
				2,
				0,
				0,
				0
			});
			Label1.Location = new System.Drawing.Point(48, 53);
			Label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			Label1.Name = "Label1";
			Label1.Size = new System.Drawing.Size(60, 18);
			Label1.TabIndex = 1;
			Label1.Text = "Down:";
			Label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
			Label2.Location = new System.Drawing.Point(41, 23);
			Label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			Label2.Name = "Label2";
			Label2.Size = new System.Drawing.Size(67, 18);
			Label2.TabIndex = 1;
			Label2.Text = "Across:";
			Label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
			Label3.AutoSize = true;
			Label3.Location = new System.Drawing.Point(189, 57);
			Label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			Label3.Name = "Label3";
			Label3.Size = new System.Drawing.Size(104, 19);
			Label3.TabIndex = 2;
			Label3.Text = "Cards Per Page:";
			lblPerPage.Location = new System.Drawing.Point(291, 57);
			lblPerPage.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			lblPerPage.Name = "lblPerPage";
			lblPerPage.Size = new System.Drawing.Size(45, 25);
			lblPerPage.TabIndex = 3;
			lblPerPage.Text = "0";
			lblPerPage.TextAlign = System.Drawing.ContentAlignment.TopCenter;
			cmdOK.Location = new System.Drawing.Point(371, 201);
			cmdOK.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			cmdOK.Name = "cmdOK";
			cmdOK.Size = new System.Drawing.Size(72, 33);
			cmdOK.TabIndex = 4;
			cmdOK.Text = "Ok";
			cmdOK.UseVisualStyleBackColor = true;
			Label4.Location = new System.Drawing.Point(41, 104);
			Label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			Label4.Name = "Label4";
			Label4.Size = new System.Drawing.Size(67, 18);
			Label4.TabIndex = 2;
			Label4.Text = "Margin:";
			Label4.TextAlign = System.Drawing.ContentAlignment.TopRight;
			NUDMargin.Location = new System.Drawing.Point(113, 102);
			NUDMargin.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			NUDMargin.Maximum = new decimal(new int[4]
			{
				50,
				0,
				0,
				0
			});
			NUDMargin.Minimum = new decimal(new int[4]
			{
				5,
				0,
				0,
				0
			});
			NUDMargin.Name = "NUDMargin";
			NUDMargin.Size = new System.Drawing.Size(58, 25);
			NUDMargin.TabIndex = 0;
			NUDMargin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			ToolTip1.SetToolTip(NUDMargin, "Number of pixels to use as a margin");
			NUDMargin.Value = new decimal(new int[4]
			{
				10,
				0,
				0,
				0
			});
			cmbFont.FormattingEnabled = true;
			cmbFont.Location = new System.Drawing.Point(113, 143);
			cmbFont.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			cmbFont.Name = "cmbFont";
			cmbFont.Size = new System.Drawing.Size(182, 25);
			cmbFont.TabIndex = 5;
			cmbFontSize.FormattingEnabled = true;
			cmbFontSize.Location = new System.Drawing.Point(320, 143);
			cmbFontSize.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			cmbFontSize.Name = "cmbFontSize";
			cmbFontSize.Size = new System.Drawing.Size(79, 25);
			cmbFontSize.TabIndex = 6;
			Label5.Location = new System.Drawing.Point(41, 147);
			Label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
			Label5.Name = "Label5";
			Label5.Size = new System.Drawing.Size(67, 18);
			Label5.TabIndex = 2;
			Label5.Text = "Font:";
			Label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
			base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 17f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(453, 246);
			base.Controls.Add(cmbFontSize);
			base.Controls.Add(cmbFont);
			base.Controls.Add(cmdOK);
			base.Controls.Add(lblPerPage);
			base.Controls.Add(Label5);
			base.Controls.Add(Label4);
			base.Controls.Add(Label3);
			base.Controls.Add(Label2);
			base.Controls.Add(Label1);
			base.Controls.Add(NUDMargin);
			base.Controls.Add(NUDAcross);
			base.Controls.Add(NUDDown);
			Font = new System.Drawing.Font("Segoe UI", 10f);
			base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			base.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			base.MaximizeBox = false;
			base.Name = "frmIndexCards";
			base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			Text = "Index Cards";
			((System.ComponentModel.ISupportInitialize)NUDDown).EndInit();
			((System.ComponentModel.ISupportInitialize)NUDAcross).EndInit();
			((System.ComponentModel.ISupportInitialize)NUDMargin).EndInit();
			ResumeLayout(false);
			PerformLayout();
		}

		private void NumericUpDown1_ValueChanged(object sender, EventArgs e)
		{
			UpdateCount();
		}

		private void cmdOK_Click(object sender, EventArgs e)
		{
			clsShared.cSettings.sSet("IndexCardsAcross", NUDAcross.Value);
			clsShared.cSettings.sSet("IndexCardsDown", NUDDown.Value);
			clsShared.cSettings.sSet("IndexCardsMargin", NUDMargin.Value);
			clsShared.cSettings.sSet("IndexCardsFont", cmbFont.Text);
			clsShared.cSettings.sSet("IndexCardsFontSize", cmbFontSize.Text);
			base.DialogResult = DialogResult.OK;
			Hide();
		}

		private void NUDAcross_ValueChanged(object sender, EventArgs e)
		{
			UpdateCount();
		}

		private void frmIndexCards_Load(object sender, EventArgs e)
		{
			base.Icon = Resources.yWriter5_Ico;
			NUDAcross.Value = new decimal(clsShared.cSettings.sGet("IndexCardsAcross", 2));
			NUDDown.Value = new decimal(clsShared.cSettings.sGet("IndexCardsDown", 3));
			NUDMargin.Value = new decimal(clsShared.cSettings.sGet("IndexCardsMargin", 10));
			FillFontCombo();
			cmbFont.Text = clsShared.cSettings.sGet("IndexCardsFont", "Times New Roman");
			cmbFontSize.Text = clsShared.cSettings.sGet("IndexCardsFontSize", "10");
			UpdateCount();
		}

		private void UpdateCount()
		{
			lblPerPage.Text = Conversions.ToString(decimal.Multiply(NUDDown.Value, NUDAcross.Value));
		}

		private void FillFontCombo()
		{
			try
			{
				cmbFontSize.Items.Clear();
				int num = 6;
				do
				{
					cmbFontSize.Items.Add(num);
					num += 2;
				}
				while (num <= 48);
				if (cmbFont.Items.Count == 0)
				{
					clsFonts cFonts = clsShared.cFonts;
					ComboBox.ObjectCollection FontComboItems = cmbFont.Items;
					cFonts.FillCombo(ref FontComboItems);
				}
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}
	}
}
